package cn.iocoder.yudao.module.peizhen.dal.mysql.hospital;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.peizhen.controller.app.hospital.vo.AppHospitalPageReqVO;
import cn.iocoder.yudao.module.peizhen.dal.dataobject.hospital.HospitalDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.peizhen.controller.admin.hospital.vo.*;

/**
 * 医院 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface HospitalMapper extends BaseMapperX<HospitalDO> {

    default PageResult<HospitalDO> selectPage(HospitalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HospitalDO>()
                .likeIfPresent(HospitalDO::getName, reqVO.getName())
                .likeIfPresent(HospitalDO::getCity, reqVO.getCity())
                .orderByAsc(HospitalDO::getSort));
    }

    default PageResult<HospitalDO> selectPage(AppHospitalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HospitalDO>()
                .likeIfPresent(HospitalDO::getName, reqVO.getName())
                .eqIfPresent(HospitalDO::getCityCode, reqVO.getCityCode())
                .orderByAsc(HospitalDO::getSort));
    }

}